from ..utils.crypto_utils import crypto_utils
from ..utils.crypto_utils import server_utils
from ..utils.config_reader import read_util
from ..utils.logger import logger
from src.backend.backend_user import backend_user
from src.backend.backend_course import backend_course
from .app_base import AppBase
from datetime import datetime

# auth_data = read_util.load_assertions('app_auth_data.yaml')
teaching_assist_data = read_util.load_assertions('teaching_assist_data.yaml')


class AppTeachingAssist:
    """
    教辅模块服务类，提供教辅相关的各种操作。
    """

    @staticmethod
    @server_utils.handle_exceptions("教辅-查询教辅列表失败")
    def binding_detail(data):
        return crypto_utils.app_post_request(url=f"/v1/teaching/binding-detail", data=crypto_utils.prepare_data(data))

    @staticmethod
    @server_utils.handle_exceptions("教辅-扫码失败")
    def sweepcode_detail(data):
        return crypto_utils.app_post_request(url=f"/v1/teaching/explain/sweepcode/details", data=crypto_utils.prepare_data(data))

    @staticmethod
    @server_utils.handle_exceptions("教辅-绑定教辅码失败")
    def user_binding_tutorial_code(data):
        return crypto_utils.app_post_request(url=f"/v1/teaching/userBindingTutorialCode", data=crypto_utils.prepare_data(data))

    @staticmethod
    @server_utils.handle_exceptions("教辅-查询绑定情况失败")
    def binding_summary(data):
        return crypto_utils.app_post_request(url=f"/v1/teaching/binding-summary", data=crypto_utils.prepare_data(data))


teaching_assist = AppTeachingAssist()
